#ifndef SERVER_H_
#define SERVER_H_
/*********************************************************/
#include "net/NetworkControl.h"
#include <Poco/Runnable.h>
#include <Poco/Thread.h>
#include <Poco/ThreadPool.h>

#define JOB_AVAILABLE_EVENT	"JOB_AVAILABLE"
/*********************************************************/
/** The heart of the server, this class will execute the jobs **/
class Server : public Poco::Runnable
{
private:
	// Members
	NetworkControl*		netCtrl;		// Pointer to the networkcontroller ( = middleware! )
	Poco::ThreadPool	tPool;			// Thread for handling jobs
	Poco::Thread		lThread;		// Handle to the local thread
	Poco::Mutex		mutex;			// Local mutual exclusion object
	bool			halt;			// Halt flag

	// Methods
	void run();					// Thread entry point

public:
	// Class control methods
	void start();
	void stop();
	
	// Constructor & Destructor
	Server();
	virtual ~Server();
};
/*********************************************************/
#endif // SERVER_H_